package example1;

/**
 * <h3>designPattern</h3>
 * <p>测试</p>
 * @author : zhang.bw
 * @date : 2021-02-26 15:46
 **/
public class DeTest {
	public static void main(String[] args) {

		// 购买一个煎饼
		ABattercake aBattercake = new Battercake();
		System.out.println(aBattercake.getDesc() + ", 销售价格: " + aBattercake.cost());

		// 购买一个加鸡蛋的煎饼
		aBattercake = new Battercake();
		aBattercake = new EggDecorator(aBattercake);
		System.out.println(aBattercake.getDesc() + ", 销售价格: " + aBattercake.cost());

		// 购买一个加两个鸡蛋的煎饼
		aBattercake = new Battercake();
		aBattercake = new EggDecorator(aBattercake);
		aBattercake = new EggDecorator(aBattercake);
		System.out.println(aBattercake.getDesc() + ", 销售价格: " + aBattercake.cost());

		// 购买一个加两个鸡蛋和一根香肠的煎饼
		aBattercake = new Battercake();
		aBattercake = new EggDecorator(aBattercake);
		aBattercake = new EggDecorator(aBattercake);
		aBattercake = new SausageDecorator(aBattercake);
		System.out.println(aBattercake.getDesc() + ", 销售价格: " + aBattercake.cost());
	}
}
